home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGMISC / FPCDOCS.LZH / INTRODUC.DOC < prev    next >
Text File  |  1988-07-25  |  17KB  |  453 lines

  1. I.  INTRODUCTION TO F-PC
  2.  
  3.  
  4.  
  5. 1.  F-PC, WHAT IS IT ALL ABOUT?
  6.  
  7.  
  8.  
  9. This Forth was implemented by Tom Zimmer, with substantial help 
  10. from Robert L. Smith. All of the direct threaded low level code 
  11. modifications came from Bob's LaForth implementation. This is yet 
  12. another step in the Forth evolution being undertaken to obtain the 
  13. ideal Forth system. This Forth maintains very high compatibility 
  14. with F83 which was it's predecessor. 
  15.  
  16. This Beta release of F-PC is a Forth that uses three main segments
  17. for Forth itself, and additional segments for other purposes, like 
  18. the editor, screen saving, etc. 
  19.  
  20. The three main segments in F-PC are:  First, a 64K segment for
  21. Code, variables, and any user arrays that are not specifically 
  22. placed in an external segment.  This segment also places the code 
  23. field of all colon definitions in the Code Segment.  Code fields 
  24. in F-PC are three (3) bytes in length.  The second segment contains
  25. the bodys of colon definitions and strings.  Its size is not 
  26. limited to 64K bytes, and can use as much memory as allowed by the 
  27. operating system.  The third segment of 64k contains the heads, or 
  28. symbols in F-PC.  The head space required is typically less than
  29. that for code or data, so this segment has been kept smaller. 
  30.  
  31. Since a typical program is about half program and half data, the 
  32. separation of code and colon space results in an easy doubling or 
  33. more of effective program space. About 300K of total data/program 
  34. space is available, with most useful utilities already loaded.  
  35. This can be increased to over 400k by deleting things you don't 
  36. need. 
  37.  
  38. A small loss in performance resulted from this separation, but the 
  39. benefits of expanded program space greatly exceeds the 
  40. disadvantages. 
  41.  
  42. The primary problem that you are likely to encounter, is that code 
  43. fields are three (3) bytes rather than 2, and the code field of a 
  44. CODE word does not point to code, but contains code. 
  45.  
  46. F-PC has moved ":" LISTs to a separate segment, so there are two
  47. bytes in the BODY of each ":" definition that points into LIST 
  48. space of the ":" definitions list of CFAs.  LIST space is accessed 
  49. with Long words, like L@ and L!. The LIST space can expand to
  50. fill all available RAM memory, not limited to a single 64K byte
  51. segment. 
  52.  
  53. VARIABLEs, CONSTANTs, and strings are handles in the same way as 
  54. F83, that is they are in CODE space. This segmentation seems to 
  55. provide a reasonable balance. As the dictionary expands, more user 
  56. data space is needed, which works well with F-PC, as most of the
  57. free space is in CODE/DATA space. 
  58.  
  59. This system will full circle meta compile and extend, with the 
  60. provided batch files for simplicity. 
  61.  
  62. As F-PC currently exists, there is about 30k of LIST dictionary
  63. space, and 40k of CODE space. which can be expanded by removing 
  64. some of the optional files from the list of load files in F-PC.SEQ.
  65. The removable files are marked. Some of these files are listed as 
  66. follows: 
  67.  
  68.         PATHSET.SEQ     WORDS.SEQ       COLOR.SEQ       DUMP.SEQ
  69.         DECOM.SEQ       DEBUG.SEQ       STATUS.SEQ      MACROS.SEQ
  70.         PATCHER.SEQ     FILSTAT.SEQ     FWORDS.SEQ
  71.  
  72. If some of these files are removed, a significant savings in 
  73. dictionary space will result. 
  74.  
  75. Fairly large programs can now be coded in F-PC, although there are
  76. still some obvious limits.  It is doubtful that ZoomRacks the 
  77. database Tom coded while at QuickView systems could be compiled in 
  78. F-PC without overlays.  ZoomRacks consisted of more than 2M bytes
  79. of source screens, and used all ram outside the program as 
  80. contiguous data space for the user. 
  81.  
  82. 2.  NEW FEATURES IN F-PC
  83.  
  84.  
  85.  
  86. The first thing you should know is that F-PC is trying to achieve a
  87. number of conflicting goals.  It is intended to be a Forth system 
  88. that provides all of the following: 
  89.  
  90. .  A system that is familiar to the large installed base of F83 
  91.    users. 
  92.  
  93. .  A system that brings Forth fully into the realm of files. 
  94.  
  95. .  A Forth system that is not as strange as possible to C and 
  96.    Pascal programmers. 
  97.  
  98. .  A system which maintains Forth's interactive nature. 
  99.  
  100. .  A system which is FAST to compile and run. 
  101.  
  102. .  A FAT system with many tools, which still has room for large 
  103.    application program. 
  104.  
  105. Impossible, you say. Perhaps, but if you give F-PC a chance you may
  106. find some things you like. In line with the above goals, here is a 
  107. list of some of F-PC's major features:
  108.  
  109. .  Direct threaded dictionary for speed. 
  110.  
  111. .  Separated lists & heads to increase space. 
  112.  
  113. .  Prefix assembler to enhance readability. 
  114.  
  115. .  Assembler supports both prefix as well as postfix assembly 
  116.    syntax for familiarity. 
  117.  
  118. .  Full DOS access from system and COMMAND level control. 
  119.  
  120. .  Full Handle/Path based file system. 
  121.  
  122. .  View works across directory boundaries. 
  123.  
  124. .  Full user configurable sequential text editor provided in 
  125.    source. 
  126.  
  127. .  Full DOS memory management interface. 
  128.  
  129. Much more of course is provided, but enough of this 
  130. editorialization. Let's get started. 
  131.  
  132.  
  133.  
  134. 3.  EXPAND THE ARC FILES 
  135.  
  136.  
  137.  
  138. The first thing to remember is DON'T PANIC !! 
  139.  
  140. Once you have expanded the files on this disk, you will likely be 
  141. a bit overloaded. Don't Panic, you don't have to consume all of 
  142. this at once, examine it a little at a time. 
  143.  
  144.                         REMEMBER! 
  145.  
  146.                 Exploration is the Method. 
  147.              HELP, VIEW and SEE are the Keys! 
  148.  
  149. Start here, and follow the bouncing ball: 
  150.  
  151. F-PC is distributed on two 5.25" MSDOS DSDD diskettes.  The first
  152. diskette contains; 
  153.  
  154.         READ.ME         Installation instructions 
  155.         PKXARC.COM      A de-archive utility 
  156.         PKARC.COM       The archive utility 
  157.         F-PC.ARC        The F-PC Forth system
  158.  
  159. Additional archive files are located on the second disk: 
  160.  
  161.         ZIMMER.ARC      Some tools from Tom Zimmer and others 
  162.         SMITH.ARC       Some tools from Bob Smith 
  163.         CURLEY.ARC      Some tools from Charles Curley 
  164.         TING.ARC        Some tools from C. H. Ting 
  165.         F-PCHELP.ARC    The F-PC help files
  166.         F-PCDOC.ARC     The F-PC documentation files
  167.  
  168. The first thing we need to do is try and fill up your hard disk. 
  169. F-PC will need about a megabyte of hard disk space. If you don't
  170. have that much available, you might think of doing some house 
  171. cleaning first. 
  172.  
  173. Create a directory on your hard disk, called \F-PC, and copy all of
  174. the files from this disk into that directory. This sequence will 
  175. do that: 
  176.                 C: <enter>         or D: if your hard disk is D: 
  177.                 CD \ <enter> 
  178.                 MD \F-PC <enter>
  179.                 CD \F-PC <enter>
  180.  
  181. Place the first disk in Drive A:. 
  182.  
  183.                 COPY A:*.* \F-PC <enter>
  184.  
  185. When the copy is finished, put the second disk in Drive A:. 
  186.  
  187.                 COPY A:*.* \F-PC <enter>
  188.  
  189. Now expand the archive files: 
  190.  
  191.                 PKXARC * <enter> 
  192.  
  193. This will result in a large number of files being added to your 
  194. hard disk, consuming about 1 and 1/4 megabyte including the 
  195. archive files. 
  196.  
  197.  
  198.  
  199. 4.  INSTALL F-PC
  200.  
  201.  
  202.  
  203. Now that you have expanded F-PC onto your hard disk, you need to
  204. install F-PC for your computer. This is done easily as follows:
  205.  
  206.                 INSTALL <enter> 
  207.  
  208. A new F-PC.EXE will be created.
  209.  
  210. This is the primary file of interest F-PC.EXE. F-PC is Full segment
  211. direct threaded Forth. You can start up that this F-PC by typing
  212. its name: 
  213.  
  214.                 F-PC <enter>
  215.  
  216. You should now be running the F-PC Forth system. If that makes you
  217. uncomfortable, you can type BYE to leave. 
  218.  
  219. Lets start off by printing some documentation. There are several 
  220. .TXT documentation files on the disk, so lets print them. Set up 
  221. your printer with at least 75 sheets of paper, and type the 
  222. following: 
  223.  
  224.                 FPRINT *.TXT *.HLP <enter> 
  225.  
  226. F-PC will print all of the text and help files in the current
  227. directory.  Among these is a file called F-PC.TXT, it will give you
  228. an overview, and some examples of the special words in F-PC, and
  229. how they are used.  The first chapter of F-PC includes a small
  230. tutorial which is included as the next section here.  You might 
  231. want to walk through it to get familiar with it. Other text files 
  232. provide additional information on specific topics. 
  233.  
  234. If you don't have a batch file called INSTALL.BAT, then you can 
  235. type the command manually as follows: 
  236.  
  237.                 KERNEL - SEQINIT FLOAD F-PC.SEQ <enter>
  238.  
  239. Either of the above will re-compile F-PC from the KERNEL file,
  240. configuring F-PC for your directory structure in the process.
  241.  
  242. You will probably want to read the screen while the install is 
  243. taking place, as several interesting messages are displayed while 
  244. the installation occurs. 
  245.  
  246.  
  247. 5.  MEMORY REQUIREMENTS 
  248.  
  249.  
  250.  
  251. F-PC is a memory HOG.  The three segments used for Forth itself is
  252. ONLY the BEGINNING.  F-PC also uses extra segment space for other
  253. things, here is a fairly complete list: 
  254.  
  255.         Forth Code Segment                              64k 
  256.         Forth List Segment                             128k
  257.         Forth Head Segment                              64k
  258.         Screen save and restore buffers                 16k 
  259.         Compiler mass storage buffering                  1k 
  260.         Macros save buffer                               2k 
  261.         Editor edit buffer                              64k editor
  262.         Editor line pointer buffer                       8k editor
  263.         Line delete/restore buffer in editor            12k editor
  264.  
  265. As you can see much of the above memory is needed by the editor.
  266. This space is not allocated until the editor is envoked. 
  267.  
  268. F-PC is even more hungry for mass storage than it is for memory. I
  269. have been able to use F-PC on a DUAL floppy based system, but there
  270. are problems. Try unarchiving the .EXE file to one disk, and the 
  271. .SEQ files to another disk. Not all the .SEQ files will fit on a 
  272. disk, but most will. 
  273.  
  274. A typical system in which F-PC can run comfortably thus requires
  275. 640K bytes of memory, 1.5M to 2M bytes of hard disk, and one or
  276. two floppy disk drives.  Less than these, you will run into minor 
  277. annoyments using F-PC.
  278.  
  279.  
  280.  
  281. 6. A SHORT TUTORIAL 
  282.  
  283.  
  284.  
  285. Once F-PC has been installed on your computer, you can start it up
  286. by typing "F-PC <enter>" from the keyboard.  This will display a
  287. sign-on message about the version number, available memory, 
  288. authors, etc. 
  289.  
  290. To opening a file, type the following:   
  291.  
  292.                     OPEN BANNER <enter> 
  293.  
  294. The file BANNER.SEQ will be opened.  We can load it with: 
  295.  
  296.                     1 LOAD <enter> 
  297.  
  298. This prints a nice demo message.  This demo came from the F83X 
  299. system written by Wil Baden. 
  300.  
  301. We can edit the source for BANNER by typing: 
  302.  
  303.                     ED <enter> 
  304.  
  305. You will now be in the editor, viewing the first 20 lines or so of 
  306. BANNER.SEQ.  You can page down through the file with the PgDn key 
  307. on the keypad, and back up with the PgUp key.  For now, page down 
  308. to the bottom of the file with PgDn, and there you see the 
  309. definition of the word DEMO, which prints out our demonstration 
  310. banner. 
  311.  
  312. Now let's create a new file and put a new DEMO definition with our 
  313. own banner message in it.  Leave the editor by typing Shift-ESC 
  314. twice, that is, hold down the Shift key and press the ESC key two 
  315. times.  You will now be back in Forth without saving any changes 
  316. you may have accidentally made to BANNER.SEQ. 
  317.  
  318. To create the new file, type the following: 
  319.  
  320.                     SED MYBANNER <enter> 
  321.  
  322. F-PC will start the editor, and try to open the file MYBANNER.  If
  323. it is present, F-PC will open it.  If it is not, then F-PC will
  324. automatically create a new file called MYBANNER.SEQ and place you 
  325. in the editor in that file, prepared to enter text. 
  326.  
  327. Type in the following definition, using the <enter> key to add new 
  328. lines to the file as needed.  The arrow keys can be used to move 
  329. around, but you will not be allowed to move below the line 
  330. containing the little up pointing triangle at the left edge of the 
  331. screen, as this represents the end of the current file. 
  332.  
  333.         : MYBANNER      ( --- ) 
  334.                         " HELLO" BANNER 
  335.                         " FROM" BANNER 
  336.                         " YOURNAME" BANNER ; 
  337.  
  338. Note that YOURNAME must be no longer than 11 characters. 
  339.  
  340. Now that you have typed in or edited the above definition into the 
  341. file BANNER.SEQ, leave the editor saving the text you have 
  342. entered, by pressing ESC twice.  DON'T use Shift this time, as we 
  343. REALLY want to save the program. 
  344.  
  345. Let's compile the program.  Type: 
  346.  
  347.                     FLOAD MYBANNER <enter> 
  348.  
  349. The file MYBANNER.SEQ is opened, and loaded.  If you entered the 
  350. program as shown, then all should be well, and Forth should come 
  351. back with the "ok" message.  You could have compiled the program 
  352. by typing 1 LOAD <enter>, since the file was already open. 
  353.  
  354. Now that MYBANNER is compiled, type its name to make it do it's 
  355. stuff: 
  356.  
  357.                     MYBANNER <enter> 
  358.  
  359. You should have seen your name scroll up on the screen, if you 
  360. didn't, try editing the source file and correcting your typing 
  361. error. 
  362.  
  363. At this point, you can VIEW the source for MYBANNER by typing: 
  364.  
  365.                     VIEW MYBANNER <enter> 
  366.  
  367. F-PC will locate the source for your MYBANNER word, and display the
  368. source file starting at the line where MYBANNER was started.  A 
  369. shorter word for VIEW called LL (Locate & List) is provided to 
  370. save typing. 
  371.  
  372. Now let's look at some Forth words with LL, and some of the other 
  373. file traversal words.  Type: 
  374.  
  375.                     LL DUP <enter> 
  376.  
  377. The source for DUP will be displayed, with the line where the 
  378. definition of DUP starts underlined.  Above the line where DUP 
  379. starts is the reverse video message showing the filename of the 
  380. source for DUP. Now type: 
  381.  
  382.                     N <enter> 
  383.  
  384. The screen will blink and display group of lines starting 16 lines 
  385. farther into the KERNEL1.SEQ source file.  With the "N" word, you 
  386. can scan quickly through a sequential file. The inverse of "N" is 
  387. "B".  If you type it followed by <enter>, the previous 16 lines 
  388. will be displayed.  Another display word "L" is provided to 
  389. redisplay the current location in the file again. 
  390.  
  391. One last word you will find VERY useful is WORDS.  It is used as 
  392. follows: 
  393.  
  394.                     WORDS HE <enter> 
  395.  
  396. The above command sequence will display all words in all 
  397. vocabularies of Forth that contain the letter sequence "HE". This 
  398. is very useful when you don't know how to spell the word you are 
  399. looking for, but you know it contains a particular character 
  400. sequence.  WORDS by it self will show all words in the current 
  401. vocabulary only, and the special sequence "*.*" following WORDS is 
  402. recognized as a command to display all words of all vocabularies. 
  403.  
  404. Here is a list of the words we have covered. 
  405.  
  406.         OPEN <filename> <enter>         Opens filename. 
  407.  
  408.         1 LOAD <enter>                  Compiles the open file. 
  409.  
  410.         ED <enter>                      Starts editing the current 
  411.                                         file. 
  412.  
  413.         SED <filename> <enter>          Specifies a file to edit. 
  414.  
  415.         FLOAD <filename> <enter>        Loads filename. 
  416.  
  417.         HELP <enter>                    Displays a help screen. 
  418.         HELP <forth_word> <enter>       Shows the source for a 
  419.         VIEW <forth_word> <enter>       Forth word. 
  420.         LL <forth_word> <enter> 
  421.  
  422.         N <enter>                       Shows next 16 lines. 
  423.  
  424.         B <enter>                       Shows previous 16 lines. 
  425.  
  426.         L <enter>                       Re-display current 16 
  427.                                         lines. 
  428.  
  429.         WORDS <sub_string> <enter>      Display all words 
  430.                                         containing 
  431.                                         <sub_string> in all 
  432.                                         vocabularies. 
  433.  
  434.         SEE <word>                      Decompile the memory copy 
  435.                                         of the word, and show the 
  436.                                         source. 
  437.  
  438.  
  439.  
  440. 7.   THE ON-LINE TUTORIAL 
  441.  
  442.  
  443.  
  444. There is also an on-line tutorial coming with F-PC.  If contains
  445. much of the same information in the above tutorial but with 
  446. different arrangement of topics.  To use this on-line tutorial, 
  447. type the following commands in F-PC and then follow the
  448. instructions:
  449.  
  450.         OPEN INTRO <enter>
  451.         L <enter>
  452.  
  453.